﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace PyNet
{
    static class clsFileSystem
    {
        public static void CheckDir(string dir)
        {
            if (!Directory.Exists(dir + "/"))
            {
                Directory.CreateDirectory(dir + "/");
                Program.GetLogger.Write("DarkGreen", "Created directory: " + dir + "/");
            }
        }

        public static string ReadData(string file)
        {
            StreamReader fs;
            try {
                fs = File.OpenText(file);
            } catch (FileNotFoundException e) {
                return "";
            }

            string data = fs.ReadToEnd();
            fs.Close();
            return data;
        }

        public static void WriteData(string file, string data)
        {
            File.WriteAllText(file, data);
        }
    }
}
